package com.heima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.pojo.dto.UserQueryDTO;
import com.heima.pojo.entity.TbRole;
import com.heima.pojo.entity.TbUser;
import com.heima.pojo.entity.User;
import com.heima.pojo.vo.UserRoleVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {
    @Select("select * from tb_user where id = #{id}")
    User getUserById(Integer id);


    List<UserRoleVO> search(UserQueryDTO dto);
    
    Long count(UserQueryDTO dto);


    List<TbRole> insertRole();

    int insertUser(TbUser tbUser);

    int updateUser(Long userId, TbUser tbUser);

    @Delete("delete from tb_user where id = #{userId}")
    int deleteUser(Long userId);
}